@import url('https://fonts.googleapis.com/css2?family=Chenla&family=Kantumruy+Pro:ital,wght@0,100..700;1,100..700&family=Moul&family=Moulpali&family=Siemreap&display=swap');

.font-1{
    font-family: "moul";
}
.font-2{
    font-family: "moulpali";
}
.font-3{
    font-family: "siemreap";
}
.font-4{
    font-family: "kantumruy-pro";
}
/* កំណត់រចនាសម្ព័ន្ធមូលដ្ឋាន */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== COMMENT SECTION - បានកែទីតាំង ===== */
.comment-section {
    position: relative; /* ✅ កែពី absolute មក relative */
    margin: 0 auto;
    background: rgba(11, 101, 32, 0.6);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.1);
    border: 2px solid #542525;
    z-index: 1000;
    width: 100%; /* ✅ បន្ថែម width */
    margin-bottom: 30px; /* ✅ បន្ថែមចន្លោះក្រោម */
}



/* ចំណងជើង */
h2, h3 {
    color: #d7d0d0;
    margin-bottom: 20px;
    text-align: center;
    font-family: "moulpali" ;
}

/* ទម្រង់សរសេរសារ */
.comment-form {
    margin-bottom: 40px;
    padding: 25px;
    background: rgba(4, 143, 185, 0.7);
    border-radius: 12px;
    border: 1px solid #ffcdd2;
}

.form-group {
    margin-bottom: 20px;
}

label {
    font-family: "moulpali";
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #0b31c6;
}

/* ប្រអប់បញ្ចូល */
input[type="text"],
input[type="email"],
textarea {
    font-family: "siemreap";
    width: 100%;
    padding: 12px;
    border: 2px solid #ffcdd2;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    background: white;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(23, 2, 251, 1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* រូបតំណាងអារម្មណ៍ */
.emoji-picker {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.emoji-picker span {
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

.emoji-picker span:hover {
    transform: scale(1.2);
}

/* ប៊ូតុងផ្ញើ */
.submit-btn {
    background: linear-gradient(45deg, #0408ec, #260000);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    display: block;
    margin: 0 auto;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

/* តារាងសារ */
.comments-list {
    border-top: 2px solid #ffcdd2;
    padding-top: 10px;
}

/* ចលនាសារ */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* សារនីមួយៗ */
.comment-item {
    background: #be9e9e;
    padding: 1px;
    margin-bottom: 5px;
    border-radius: 10px;
    border-left: 5px solid #0202d8;
    position: relative;
    animation: fadeIn 0.5s ease-in;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.comment-header strong {
    color: #f8f8fa;
    font-size: 18px;
    text-decoration: underline;
}

.comment-date {
    color: #1a0163;
    font-size: 12px;
}

.comment-content {
    color: white;
    line-height: 1.5;
    margin-bottom: 5px;
    font-size: 15px;
}

.comment-email {
    font-size: 14px;
    color: #666;
    margin-top: 8px;
}
.insert-name{
    font-family: "siemreap";
    font-size: 12px;
    font-style: italic;
    color: rgb(222, 213, 213);
}
.comment-edited {
    font-size: 12px;
    color: #013f1f;
    font-style: italic;
    margin-top: 5px;
}

/* ===== ប៊ូតុងសកម្មភាព ===== */
.comment-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

/* ប៊ូតុងកែសម្រួល */
.edit-btn {
    background: linear-gradient(25deg, #e6f205, #ffb74d);
    color: white;
    padding: 5px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: "siemreap";
    font-size: 14px;
    transition: all 0.3s;
    font-weight: bold;
}

.edit-btn:hover {
    background: linear-gradient(45deg, #028023, #03017f);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 167, 38, 0.3);
}

/* ប៊ូតុងលុប */
.delete-btn {
    background: linear-gradient(45deg, #9f534e, #ef5350);
    color: white;
    padding: 5px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: "siemreap";
    transition: all 0.3s;
    font-weight: bold;
}

.delete-btn:hover {
    background: linear-gradient(45deg, #d32f2f, #e53935);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(244, 67, 54, 0.3);
}

/* ===== ទម្រង់កែសម្រួល ===== */
.edit-form {
    display: none;
    background: #fff3e0;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #ffb74d;
    margin-top: 10px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.edit-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid #ffb74d;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    resize: vertical;
    background: white;
    transition: all 0.3s;
}

.edit-textarea:focus {
    outline: none;
    border-color: #ff9800;
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.3);
}

/* ប៊ូតុងសកម្មភាពកែសម្រួល */
.edit-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* ប៊ូតុងបោះបង់ */
.cancel-edit-btn {
    background: linear-gradient(45deg, #78909c, #90a4ae);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-weight: bold;
}

.cancel-edit-btn:hover {
    background: linear-gradient(45deg, #546e7a, #607d8b);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(120, 144, 156, 0.3);
}

/* ប៊ូតុងរក្សាទុក */
.save-edit-btn {
    background: linear-gradient(45deg, #4caf50, #66bb6a);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-weight: bold;
}

.save-edit-btn:hover {
    background: linear-gradient(45deg, #388e3c, #4caf50);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
}

.save-edit-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ស្ថានភាពកំពុងកែសម្រួល */
.comment-item.editing .comment-content,
.comment-item.editing .comment-actions {
    display: none;
}

.comment-item.editing .edit-form {
    display: block;
}

.comment-item.editing {
    background: #fff8e1;
    border-left-color: #ffa726;
    box-shadow: 0 4px 15px rgba(255, 167, 38, 0.2);
}

/* សារផ្សេងៗ */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
    border: 1px solid #c3e6cb;
    animation: fadeIn 0.5s ease-in;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
    border: 1px solid #f5c6cb;
    animation: fadeIn 0.5s ease-in;
}

.no-comments {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #ffcdd2;
}

.loading {
    text-align: center;
    color: #666;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #ffcdd2;
}

.debug-info {
    background: #e9ecef;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    border-left: 3px solid #6c757d;
}

/* 📱 PHONE - ទូរស័ព្ទតូចៗ (រហូតដល់ 574px) */
@media (max-width: 574px) {
    .comment-section {
        width: 98%;
        padding: 10px;
        margin-top: 50px;
        margin-left: auto;  /* ✅ កណ្តាល */
        margin-right: auto; /* ✅ កណ្តាល */
        margin-bottom: 40px; /* ✅ បន្ថែមចន្លោះក្រោម */
        font-size: 20px;
    }
    
    .comment-form {
        padding: 20px;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
     .insert-name{
        font-size: 10px;
    }    
     h3{
        font-size: 15px;
    }
    
    /* ✅ កែត្រង់នេះ - ប៊ូតុងនៅទន្ទឹមគ្នា */
    .comment-actions {
        flex-direction: row;  /* ✅ ផ្លាស់ពី column មក row */
        gap: 8px;
        justify-content: flex-end;
        margin-top: 15px;
    }

    .edit-btn,
    .delete-btn {
        width: auto;  /* ✅ កែពី 100% មក auto */
        padding: 8px 12px;  /* ✅ កែ padding ឲ្យសម */
        font-size: 12px;    /* ✅ កែ font-size បើត្រូវការ */
    }
    
    .comment-item {
        padding: 15px;
    }
    
    .edit-form {
        padding: 12px;
    }
}

/* 📊 TABLET - 575px ឡើងទៅ */
@media (min-width: 575px) {
    .comment-section {
        width: 560px;
        padding: 10px;
        margin-top: 50px;
        margin-left: auto;  /* ✅ កណ្តាល */
        margin-right: auto; /* ✅ កណ្តាល */
        margin-bottom: 40px; /* ✅ បន្ថែមចន្លោះក្រោម */
        font-size: 20px;
    }
    
    .insert-name{
        font-size: 15px;

    }    

    /* ===== ប៊ូតុងសកម្មភាព ===== */
    .comment-actions {
        display: flex;
        gap: 10px;
        justify-content: flex-end;
        margin-top: 15px;
        flex-direction: row;  /* ✅ បន្ថែមនេះ */
    }

    /* ប៊ូតុងកែសម្រួល */
    .edit-btn {
        background: linear-gradient(25deg, #e6f205, #ffb74d);
        color: white;
        padding: 8px 16px;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
        transition: all 0.3s;
        font-weight: bold;
    }
    h3{
        font-size: 15px;
    }
    .submit-btn{
        font-family: "siemreap";
        color: white;
        background-color: blue;
    }

    .comment-form {
        padding: 20px;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
   
    
    .comment-item {
        padding: 15px;
    }
    
    .edit-form {
        padding: 12px;
    }

/* ប៊ូតុងកំពុងផ្ទុក */
.submit-btn:disabled,
.edit-btn:disabled,
.delete-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.submit-btn:disabled:hover,
.edit-btn:disabled:hover,
.delete-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ពន្លឺពេល hover សម្រាប់សារ */
.comment-item:hover {
    box-shadow: 0 4px 15px rgb(15, 0, 223);
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

/* រចនាសម្រាប់សារដែលកំពុងត្រូវកែសម្រួល */
.comment-item.editing:hover {
    box-shadow: 0 4px 20px rgba(255, 167, 38, 0.25);
    transform: translateY(-2px);
}}
